<template>
	<!-- 一般借款审核 -->
	<view>
		<!-- 基本信息 -->
		<CellChild :addlist='addlist' title='基本信息' :rows='rows' :fileNo = 'fileNo'>
		</CellChild>

		<!-- 借款信息 -->
		<view v-for='(item,index) in detaileEntityList'>
			<CellChild :addlist='addlist1' title='借款信息' :rows='item'>
				
			</CellChild>
		</view>
		
		<!-- 未冲销借款信息 -->
		<CellChild :addlist='addlist2' title='未冲销借款信息' :rows='rows'>
			
		</CellChild>

	</view>
</template>

<script>
	export default {
		components:{
			
		},
		data() {
			return {
				genlist:[],
				rows:[],
				addlist: [{
						tit: '借款单号',
						val: 'borrowNo'
					},
					{
						tit: '申请人',
						val: 'userName'
					},
					// {
					// 	tit: '工号',
					// 	val: 'empNo'
					// },
					// {
					// 	tit: '费用承担科室',
					// 	val: 'subdeptNm'
					// },
					// {
					// 	tit: '联系电话',
					// 	val: 'phone'
					// },
					{
						tit: '费用承担科室',
						val: 'deptNm'
					},
					{
						tit: '借款类型',
						val: 'payeeType'
					},
					{
						tit: '单据日期',
						val: 'billDate'
					},
					{
						tit: '币种',
						val: 'coinKind'
					},
					{
						tit: '关联单据',
						val: 'relationBill'
					},
					{
						tit: '合同编号',
						val: 'contractNo'
					},
					{
						tit: '合同名称',
						val: 'contractNm'
					},
					{
						tit: '借款说明',
						val: 'reasons'
					},
					// {
					// 	tit: '是否上传附件',
					// 	val: '是'
					// },
				],
				addlist1: [
					{
						tit: '收款方类型',
						val: 'payeeType',
					},
					// {
					// 	tit: '申请借款金额',
					// 	val: 'borrowAmt',
					// 	type:'number'
					// },
					// {
					// 	tit: '审批借款金额',
					// 	val: 'borrowAmt',
					// 	type:'number'
						
					// },
					{
						tit: '收款方',
						val: 'payee'
					},
					{
						tit: '开户行名称',
						val: 'payeeNm'
					},
					{
						tit: '银行账号',
						val: 'bankcardNo'
					},
					{
						tit: '借款金额',
						val: 'borrowAmt',
						type:'number'
					},
				],
				addlist2: [
					{
						tit: '借款单号',
						val: 'borrowNo',
					},{
						tit: '借款说明',
						val: 'reasons',
					},{
						tit: '借款类型',
						val: 'payeeType',
					},{
						tit: '借款金额',
						val: 'borrowAmt',
						type:'number'
					},{
						tit: '借款时间',
						val: 'billDate',
					}
				],
				fileNo:[],
				detaileEntityList:[]
			}
		},
		onLoad() {
			//获取流程页面的流程上下文[实用的流程信息从这里获取]
			 let borrowNo= window.parent.myvm.wfContext.BusinessKey;
			 this.fileNo = window.parent.myvm.wfContext.BusinessKey;
			 this.getlist(borrowNo)
		},
		mounted() {
			var that = this;
			window.myvm = that;
			window.$urlFormVue = that;
		},
		methods: {
			getlist(borrowNo){
				let _this = this
				const params = {
					borrowNo
				}
				_this.$lyRequest.post('/gateway/reim/mp/dbsap/reim/borrowm/show.do',
					params,'from'
				).then((result)=>{
					if(result.success){
						this.rows = result.data.rows
						this.detaileEntityList = result.data.rows.detaileEntityList
						for(let i = 0;i<=this.detaileEntityList.length;i++){
							if(this.detaileEntityList[i].payeeType == '0'){
								this.detaileEntityList[i].payeeType ='对私'
							}else if(this.detaileEntityList[i].payeeType == '1'){
								this.detaileEntityList[i].payeeType == '对公'
							}
						}
					}else{
						console.log(result.data.msg)
					}
				})
				if(this.rows.payeeType){
					switch (this.rows.payeeType){
						case '0':
							this.rows.payeeType ='员工'
							break
					}
				}
				
			},
			//审批和驳回-工作流点击"提交"时触发此函数，返回:空字符串:工作流继续提交，返回"具体错误信息":工作流不提交
			rejectWorkflow(btnDef) {
				return "";
			},
			//作废-工作流点击"作废"时触发此函数，返回:空字符串:工作流继续提交，返回"具体错误信息":工作流不提交
			//content为作废意见
			invalidWorkflow(content) {
				return "";
			},
			//转办-工作流点击"确认转办"时触发此函数，返回:空字符串:工作流继续提交，返回"具体错误信息":工作流不提交
			//opinion:转办意见
			referredWorkflow(opinion) {
				return "";
			},
			//校验-工作流点击"提交"时触校验函数，返回:true校验通过，false校验不通过；
			//也可以返回具体的错误信息：空字符串，校验通过，返回具体错误信息校验不通过，同时弹出具体的错误信息。
			validateWorkflowForm(btnDef,callback) {
				callback("");
			},
			//提交单据
			sendWorkflow(btnDef, callback) {
				callback("");
			},
		}
	}
</script>

<style scoped lang="scss">
	view {
		font-family: pf;
	}

	.bottom_setup {
		width: 100%;
		height: 160rpx;
		background-color: white;
		margin-top: 20rpx;
		padding: 35rpx 0;
		box-sizing: border-box;
		box-shadow: 5px -10rpx 5px 0px rgba(225, 225, 225, .4), ;

		.bottom_white1 {
			display: flex;
			flex-direction: row;
			align-items: center;
			justify-content: space-between;
			height: 100rpx;

			.custom-styles {
				padding: 20rpx 30rpx;
				width: 300rpx;
				height: 100rpx;
			}

			.custom-style {
				padding: 20rpx 30rpx;
				width: 300rpx;
				height: 100rpx;
				background-color: #007aff;
			}
		}
	}
	
</style>
